function inspect(inspector, title){
    var expression, result;
    
    if ("ignore" in arguments.callee) 
        return;
    
    while (true) {
        var message = "";
        if (title) 
            message = title + '\n';
        
        if (expression) 
            message += '\n' + expression + '===>' + result + '\n';
        else 
            expression = '';
        
        message += 'Enter a expression to evluate';
        
        expression = prompt(message, expression);
        
        if (!expression) 
            return;
        
        result = inspector(expression);
    }
}

function factorial(n){
    var inspector = function($){
        return eval($);
    }
    inspect(inspector, "Entering factorial()");
    var result = 1;
    while (n > 1) {
        result = result * n;
        n--;
        inspect(inspector, "factorial() loop");
    }
    inspect(inspector, "Exiting factorial()");
    return result;
}

function getCode(str){
	var code=str.match(/\#\d{4,6}/g);
	if(code)
		return code[0].slice(1);
	else
		return "0000";
}
